import {get,post,postJson} from '../http.js'

// 样例
export function getById(params){
    return get('/book/getById',params)
}
// 主页面操作
export function getShoppingCartNum(){
    return get('/shoppingCart/getShoppingCartNum',null)
}
// 购物车界面
export function getShoppingCartData(){
    return get('/shoppingCart/getShoppingCartData',null)
}
export function getUser(){
    return get('/user/getUser',null)
}
export function getMarketerPageData(params){
    return post('/marketer/getMarketerPageData',params)
}
export function getSearchData(formdata){
    return get('/user/getSearchData',formdata)
}
export function shoppingCart(formdata){
    return postJson('/user/saveShoppingCart',formdata)
}
export function search(params){
    return get('/user/search',params)
}
export function cancel(formdata){
    return post('/shoppingCart/cancel',formdata)
}
// 详情界面获取数据
export function getDetailData(formdata){
    return post('/Dish/getDetailData',formdata)
}
// 获取当前下单地址
export function getAddressAndDish(formdata){
    return post('/user/getAddressAndDish',formdata)
}
// 添加送货地址
export function save(formdata){
    return postJson('/addressbook/save',formdata)
}
export function toPay(formdata){
    return postJson('/orders/save',formdata)
}

export function updateOrder(formdata){
    return postJson('/orders/update',formdata)
}


// 订单操作
export function getOrderData(formdata){
    return get('/orders/getOrderDataById',formdata)
}
export function getUserSimpleInfo(formdata){
    return get('/user/getUserSimpleInfo',formdata)
}
export function toCancelOrder(formdata){
    return get('/orders/toCancelOrder',formdata)
}
export function toCancelPay(formdata){
    return postJson('/orders/toCancelPay',formdata)
}

export function getDishListByMarketerId(formdata){
    return post('/Dish/getDishListByMarketerId',formdata)
}
// 添加到购物车
export function addToShoppingCart(formdata){
    return postJson('/shoppingCart/save',formdata)
}